<?php
$pid = $_GET[id];
$con = mysqli_connect ( "localhost", "cms", "cms", "cms" );
// Check connection
if (mysqli_connect_errno ()) {
	echo "Failed to connect to MySQL: " . mysqli_connect_error ();
}

$settings = mysqli_query ( $con, "SELECT front_page_id FROM configuration" );
$setting = mysqli_fetch_array ( $settings ); // expecting just one row

$result = mysqli_query ( $con, "SELECT title,content FROM page WHERE id = '$setting[front_page_id]'" );

$row = mysqli_fetch_array ( $result )
?>

<!DOCTYPE html>
<html>
	<head>
<!-- 		<link rel="stylesheet" type="text/css" href="main.css"> -->
	<title>
			<?php
			if ($row [title]) {
				echo $row [title];
			} else {
				echo "Page not found";
			}
			?>
		</title>
	</head>
	<body>
		<div>
			<a href="<?php echo 'admin/edit_page.php?id='.$pid; ?>">Edit page</a>
		</div>
		<div>
			<a href="admin">Administration</a>
		</div>
	<?php include("topmenu.php")?>
		<?php
		if ($row [content]) {
			echo $row [content];
		} else {
			echo "Page not found";
		}
		?>
	</body>
</html>